package com.better.common.jwtauth.secruity;

import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * 获取用户登录时携带的额外信息的功能
 * Created by Administrator on 2017/12/7.
 */
public class JwtWebAuthenticationDetails extends WebAuthenticationDetails {

    private static final long serialVersionUID = 6975601077710753878L;
    private final String validcode;

    public JwtWebAuthenticationDetails(HttpServletRequest request) {
        super(request);
        validcode = request.getParameter("validcode");
    }

    public String getValidcode() {
        return validcode;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(super.toString()).append("; Validcode: ").append(this.getValidcode());
        return sb.toString();
    }
}
